/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef NODECPP_UTIL_OPTION_H_
#define NODECPP_UTIL_OPTION_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include <string>

namespace NodeCpp {
namespace Util {

    class Option
    {
    public:
        Option(const std::string& _Name, const std::string& _ShortName,
            const std::string& _Description);
        ~Option(void);

        const std::string& name(void) const { return Name_; }
        const std::string& GetShortName(void) const { return ShortName_; }
        const std::string& description(void) const { return Description_; }
        void SetValue(const std::string& _Value) { Value_ = _Value; }
        const std::string& value(void) const { return Value_; }

        Option& HasArg(bool _Has) { HasArg_ = _Has; return *this; }
        bool HasArg(void) const { return HasArg_; }
        Option IsRequired(bool _Required) { Required_ = _Required; return *this; }
        bool IsRequired(void) const { return Required_; }
        void SetValid(bool _Valid) { Valid_ = _Valid; }
        bool IsValid(void) const { return Valid_; }

        bool MatchName(const std::string& _Name);
        bool MatchShortName(const std::string& _ShortName);
    
    private:
        std::string Name_;
        std::string ShortName_;
        std::string Description_;
        std::string Value_;
        bool HasArg_;
        bool Required_;
        bool Valid_;
    };

}}

#endif // NODECPP_UTIL_OPTION_H_
